home *** CD-ROM | disk | FTP | other *** search
-
-
-
- RRRRWWWWTTTTVVVVaaaallllMMMMuuuullllttttiiiiMMMMaaaapppp((((3333CCCC++++++++)))) RRRRWWWWTTTTVVVVaaaallllMMMMuuuullllttttiiiiMMMMaaaapppp((((3333CCCC++++++++))))
-
-
-
- NNNNaaaammmmeeee
- RWTValMultiMap<K,T,C> - Rogue Wave library class
-
- SSSSyyyynnnnooooppppssssiiiissss
- #include <rw/tvmmap.h>
- RWTValMultiMap<K,T,C> m;
-
-
-
- SSSSttttaaaannnnddddaaaarrrrdddd CCCC++++++++ LLLLiiiibbbbrrrraaaarrrryyyy DDDDeeeeppppeeeennnnddddeeeennnntttt!!!!
-
-
-
- RRRRWWWWTTTTVVVVaaaallllMMMMuuuullllttttiiiiMMMMaaaapppp requires the Standard C++ Library.
-
-
- DDDDeeeessssccccrrrriiiippppttttiiiioooonnnn
- This class maintains a collection of keys, each with an associated item
- of type TTTT. Order is determined by the key according to a comparison
- object of type CCCC. CCCC must induce a total ordering on elements of type KKKK
- via a public member
- bbbboooooooollll ooooppppeeeerrrraaaattttoooorrrr(((())))((((ccccoooonnnnsssstttt KKKK&&&& xxxx,,,, ccccoooonnnnsssstttt KKKK&&&& yyyy)))) ccccoooonnnnsssstttt which returns ttttrrrruuuueeee if
- xxxx and its partner should precede yyyy and its partner within the collection.
- The structure lllleeeessssssss<<<<TTTT>>>> from the C++-standard header file <<<<ffffuuuunnnnccccttttiiiioooonnnnaaaallll>>>> is
- an example. RRRRWWWWTTTTVVVVaaaallllMMMMuuuullllttttiiiiMMMMaaaapppp<<<<KKKK,,,,TTTT,,,,CCCC>>>> may contain multiple keys that compare
- equal to each other. (RRRRWWWWTTTTVVVVaaaallllMMMMaaaapppp<<<<KKKK,,,,TTTT,,,,CCCC>>>> will not accept a key that
- compares equal to any key already in the collection.) Equality is based
- on the comparison object and not on the ======== operator. Given a comparison
- object ccccoooommmmpppp, keys aaaa and bbbb are equal if
- !!!!ccccoooommmmpppp((((aaaa,,,,bbbb)))) &&&&&&&& !!!!ccccoooommmmpppp((((bbbb,,,,aaaa)))).
-
- PPPPeeeerrrrssssiiiisssstttteeeennnncccceeee
- Isomorphic.
-
- EEEExxxxaaaammmmpppplllleeeessss
- In this example, a map of RRRRWWWWCCCCSSSSttttrrrriiiinnnnggggs and RRRRWWWWDDDDaaaatttteeees is exercised.
-
- //
-
-
-
- // tvmmbday.cpp
- //
- #include <rw/tvmmap.h>
- #include <rw/cstring.h>
- #include <rw/rwdate.h>
- #include <iostream.h>
- #include <function.h>
- main(){
- typedef RWTValMultiMap<RWCString, RWDate, less<RWCString> >
- RWMMap;
- RWMMap birthdays;
-
-
-
- PPPPaaaaggggeeee 1111
-
-
-
-
-
-
- RRRRWWWWTTTTVVVVaaaallllMMMMuuuullllttttiiiiMMMMaaaapppp((((3333CCCC++++++++)))) RRRRWWWWTTTTVVVVaaaallllMMMMuuuullllttttiiiiMMMMaaaapppp((((3333CCCC++++++++))))
-
-
-
- birthdays.insert("John", RWDate(12, "April",1975));
- birthdays.insert("Ivan", RWDate(2, "Nov", 1980));
- birthdays.insert("Mary", RWDate(22, "Oct", 1987));
- birthdays.insert("Ivan", RWDate(19, "June", 1971));
- birthdays.insert("Sally",RWDate(15, "March",1976));
- birthdays.insert("Ivan", RWDate(6, "July", 1950));
- // How many "Ivan"s?
- RWMMap::size_type n = birthdays.occurrencesOf("Ivan");
- RWMMap::size_type idx = 0;
- cout << "There are " << n << " Ivans:" << endl;
- RWMMap::iterator iter = birthdays.std().lower_bound("Ivan");
- while (++idx <= n)
- cout << idx << ". " << (*iter++).second << endl;
- return 0;
- }
- Program Output:
- There are 3 Ivans:
- 1. 11/02/80
- 2. 06/19/71
-
- RRRReeeellllaaaatttteeeedddd CCCCllllaaaasssssssseeeessss
- 3. 07/06/50
-
-
- Class RRRRWWWWTTTTVVVVaaaallllMMMMaaaapppp<<<<KKKK,,,,TTTT,,,,CCCC>>>> offers the same interface to a collection that
- will not accept multiple keys that compare equal to each other.
- RRRRWWWWTTTTVVVVaaaallllMMMMuuuullllttttiiiiSSSSeeeetttt<<<<TTTT,,,,CCCC>>>> maintains a collection of keys without the associated
- values. Class mmmmuuuullllttttiiiimmmmaaaapppp<<<<KKKK,,,,TTTT,,,,CCCC,,,,aaaallllllllooooccccaaaattttoooorrrr>>>> is the C++-standard collection
- that serves as the underlying implementation for this collection.
-
- PPPPuuuubbbblllliiiicccc TTTTyyyyppppeeeeddddeeeeffffssss
- typedef multimap<K,T,C,allocator> container_type;
- typedef container_type::iterator iterator;
- typedef container_type::const_iterator const_iterator;
- typedef container_type::size_type size_type;
- typedef pair <const K,T> value_type;
- typedef pair <const K,T>& reference;
- typedef const pair <const K,T>& const_reference;
-
-
-
- PPPPuuuubbbblllliiiicccc CCCCoooonnnnssssttttrrrruuuuccccttttoooorrrrssss
- RRRRWWWWTTTTVVVVaaaallllMMMMuuuullllttttiiiiMMMMaaaapppp<<<<KKKK,,,,TTTT,,,,CCCC>>>>(const C& comp = C());
-
-
- Constructs an empty map with comparator ccccoooommmmpppp.
-
- RRRRWWWWTTTTVVVVaaaallllMMMMuuuullllttttiiiiMMMMaaaapppp<<<<KKKK,,,,TTTT,,,,CCCC>>>>(const container_type& m);
-
-
- Constructs a map by copying all elements of mmmm.
-
-
-
-
- PPPPaaaaggggeeee 2222
-
-
-
-
-
-
- RRRRWWWWTTTTVVVVaaaallllMMMMuuuullllttttiiiiMMMMaaaapppp((((3333CCCC++++++++)))) RRRRWWWWTTTTVVVVaaaallllMMMMuuuullllttttiiiiMMMMaaaapppp((((3333CCCC++++++++))))
-
-
-
- RRRRWWWWTTTTVVVVaaaallllMMMMuuuullllttttiiiiMMMMaaaapppp<<<<KKKK,,,,TTTT,,,,CCCC>>>>(const RWTValMultiMap<K,T,C>& rwm);
-
-
- Copy constructor.
-
- RRRRWWWWTTTTVVVVaaaallllMMMMuuuullllttttiiiiMMMMaaaapppp<<<<KKKK,,,,TTTT,,,,CCCC>>>>
- (const value_type* first, const value_type* last,
- const C& comp = C());
-
-
- Constructs a map by copying elements from the array of TTTTs pointed to by
- ffffiiiirrrrsssstttt, up to, but not including, the element pointed to by llllaaaasssstttt.
-
-
-
-
-
- PPPPuuuubbbblllliiiicccc MMMMeeeemmmmbbbbeeeerrrr OOOOppppeeeerrrraaaattttoooorrrrssss
- RWTValMultiMap<K,T,C>&
- ooooppppeeeerrrraaaattttoooorrrr====(const RWTValMultiMap<K,T,C>& m);
- RWTValMultiMap<K,T,C>&
- ooooppppeeeerrrraaaattttoooorrrr====(const container_type& m) const;
-
-
- Destroys all elements of self and replaces them by copying all
- associations from mmmm....
-
- bool
- ooooppppeeeerrrraaaattttoooorrrr<<<<(const RWTValMultiMap<K,T,C>& m);
- bool
- ooooppppeeeerrrraaaattttoooorrrr<<<<(const container_type& m) const;
-
-
- Returns ttttrrrruuuueeee if self compares lexicographically less than mmmm, otherwise
- returns ffffaaaallllsssseeee. Assumes that type KKKK has well-defined less-than semantics
- (TTTT::::::::ooooppppeeeerrrraaaattttoooorrrr<<<<((((ccccoooonnnnsssstttt KKKK&&&&)))) or equivalent).
-
- bool
- ooooppppeeeerrrraaaattttoooorrrr========(const RWTValMultiMap<K,T,C>& m) const;
- bool
- ooooppppeeeerrrraaaattttoooorrrr========(const container_type& m) const;
-
-
- Returns ttttrrrruuuueeee if self compares equal to mmmm, otherwise returns ffffaaaallllsssseeee. Two
- collections are equal if both have the same number of entries, and
- iterating through both collections produces, in turn, individual pairs
- that compare equal to each other.
-
- PPPPuuuubbbblllliiiicccc MMMMeeeemmmmbbbbeeeerrrr FFFFuuuunnnnccccttttiiiioooonnnnssss
- void
- aaaappppppppllllyyyy(void (*fn)(const K&, T&, void*),void* d);
- void
-
-
-
- PPPPaaaaggggeeee 3333
-
-
-
-
-
-
- RRRRWWWWTTTTVVVVaaaallllMMMMuuuullllttttiiiiMMMMaaaapppp((((3333CCCC++++++++)))) RRRRWWWWTTTTVVVVaaaallllMMMMuuuullllttttiiiiMMMMaaaapppp((((3333CCCC++++++++))))
-
-
-
- aaaappppppppllllyyyy(void (*fn)(const K&, const T&, void*),void* d) const;
-
-
- Applies the user-defined function pointed to by ffffnnnn to every association
- in the collection. This function must have one of the prototypes:
-
-
-
-
-
- void yourfun(const K& key, T& a, void* d);
- void yourfun(const K& key, const T& a,void* d);
-
-
- Client data may be passed through parameter dddd.
-
- void
- aaaappppppppllllyyyyTTTTooooKKKKeeeeyyyyAAAAnnnnddddVVVVaaaalllluuuueeee(void (*fn)(const K&, T&, void*),void* d);
- void
- aaaappppppppllllyyyyTTTTooooKKKKeeeeyyyyAAAAnnnnddddVVVVaaaalllluuuueeee
- (void (*fn)(const K&, const T&, void*),void* d) const;
-
-
- This is a deprecated version of the aaaappppppppllllyyyy member above. It behaves
- exactly the same as aaaappppppppllllyyyy....
-
- iterator
- bbbbeeeeggggiiiinnnn();
- const_iterator
- bbbbeeeeggggiiiinnnn() const;
-
-
- Returns an iterator positioned at the first pair in self.
-
- void
- cccclllleeeeaaaarrrr();
-
-
- Clears the collection by removing all items from self. Each key and its
- associated item will have its destructor called.
-
- bool
- ccccoooonnnnttttaaaaiiiinnnnssss(const K& key) const;
-
-
- Returns ttttrrrruuuueeee if there exists a key jjjj in self that compares equal to kkkkeeeeyyyy,
- otherwise returns ffffaaaallllsssseeee.
-
- bool
- ccccoooonnnnttttaaaaiiiinnnnssss
- (bool (*fn)(const_reference,void*),void* d) const;
-
-
-
-
- PPPPaaaaggggeeee 4444
-
-
-
-
-
-
- RRRRWWWWTTTTVVVVaaaallllMMMMuuuullllttttiiiiMMMMaaaapppp((((3333CCCC++++++++)))) RRRRWWWWTTTTVVVVaaaallllMMMMuuuullllttttiiiiMMMMaaaapppp((((3333CCCC++++++++))))
-
-
-
- Returns ttttrrrruuuueeee if there exists an association a in self such that the
- expression ((((((((****ffffnnnn))))((((aaaa,,,,dddd)))))))) is ttttrrrruuuueeee, otherwise returns ffffaaaallllsssseeee. ffffnnnn points to a
- user-defined tester function which must have prototype:
-
-
-
-
-
- bool yourTester(const_reference a, void* d);
-
-
- Client data may be passed through parameter dddd.
-
- iterator
- eeeennnndddd();
- const_iterator
- eeeennnndddd() const;
-
-
- Returns an iterator positioned "just past" the last association in self.
-
- size_type
- eeeennnnttttrrrriiiieeeessss() const;
-
-
- Returns the number of associations in self.
-
- bool
- ffffiiiinnnndddd(const K& key, Key& r) const;
-
-
- If there exists a key jjjj in self that compares equal to kkkkeeeeyyyy, assigns jjjj to
- rrrr and returns ttttrrrruuuueeee. Otherwise, returns ffffaaaallllsssseeee and leaves the value of rrrr
- unchanged.
-
- bool
- ffffiiiinnnndddd(bool (*fn)(const_reference,void*),void* d,
- pair<K,T>& r) const;
-
-
- If there exists an association aaaa in self such that the expression
- ((((((((****ffffnnnn))))((((aaaa,,,,dddd)))))))) is ttttrrrruuuueeee, assigns aaaa to rrrr and returns ttttrrrruuuueeee. Otherwise,
- returns ffffaaaallllsssseeee and leaves the value of kkkk unchanged. ffffnnnn points to a user-
- defined tester function which must have prototype:
-
-
-
-
-
- bool yourTester(const_reference a, void* d);
-
-
-
-
-
- PPPPaaaaggggeeee 5555
-
-
-
-
-
-
- RRRRWWWWTTTTVVVVaaaallllMMMMuuuullllttttiiiiMMMMaaaapppp((((3333CCCC++++++++)))) RRRRWWWWTTTTVVVVaaaallllMMMMuuuullllttttiiiiMMMMaaaapppp((((3333CCCC++++++++))))
-
-
-
- Client data may be passed through parameter dddd.
-
- bool
- ffffiiiinnnnddddVVVVaaaalllluuuueeee(const K& key, T& r) const;
-
-
- If there exists a key jjjj in self that compares equal to kkkkeeeeyyyy, assigns the
- item associated with jjjj to rrrr and returns ttttrrrruuuueeee. Otherwise, returns ffffaaaallllsssseeee
- and leaves the value of rrrr unchanged.
-
- bool
- ffffiiiinnnnddddKKKKeeeeyyyyVVVVaaaalllluuuueeee(const K& key, K& kr, T& tr) const;
-
-
- If there exists a key jjjj in self that compares equal to kkkkeeeeyyyy, assigns jjjj to
- kkkkrrrr, assigns the item associated with jjjj to trrrr,,,, and returns ttttrrrruuuueeee.
- Otherwise, returns ffffaaaallllsssseeee and leaves the values of kkkkrrrr and ttttrrrr unchanged.
-
- bool
- iiiinnnnsssseeeerrrrtttt(const K& key, const T& a);
-
-
- Adds kkkkeeeeyyyy with associated item aaaa to the collection. Returns ttttrrrruuuueeee.
-
- bool
- iiiinnnnsssseeeerrrrttttKKKKeeeeyyyyAAAAnnnnddddVVVVaaaalllluuuueeee(const K& key, const T& a);
-
-
- This is a deprecated version of the iiiinnnnsssseeeerrrrtttt member above. It behaves
- exactly the same as iiiinnnnsssseeeerrrrtttt....
-
- bool
- iiiissssEEEEmmmmppppttttyyyy() const;
-
-
- Returns ttttrrrruuuueeee if there are no items in the collection, ffffaaaallllsssseeee otherwise.
-
- size_type
- ooooccccccccuuuurrrrrrrreeeennnncccceeeessssOOOOffff(const K& key) const;
-
-
- Returns the number of keys jjjj in self that compare equal to kkkkeeeeyyyy.
-
- size_type
- ooooccccccccuuuurrrrrrrreeeennnncccceeeessssOOOOffff(bool (*fn)(const_reference,void*),
- void* d) const;
-
-
- Returns the number of associations aaaa in self such that the
- expression((((((((****ffffnnnn))))((((aaaa,,,,dddd)))))))) is ttttrrrruuuueeee. ffffnnnn points to a user-defined tester
- function which must have prototype:
-
-
-
-
- PPPPaaaaggggeeee 6666
-
-
-
-
-
-
- RRRRWWWWTTTTVVVVaaaallllMMMMuuuullllttttiiiiMMMMaaaapppp((((3333CCCC++++++++)))) RRRRWWWWTTTTVVVVaaaallllMMMMuuuullllttttiiiiMMMMaaaapppp((((3333CCCC++++++++))))
-
-
-
-
-
-
-
- bool yourTester(const_reference a, void* d);
-
-
- Client data may be passed through parameter dddd.
-
- bool
- rrrreeeemmmmoooovvvveeee(const K& key);
-
-
- Removes the first association with key jjjj in self where j compares equal
- to kkkkeeeeyyyy and returns ttttrrrruuuueeee. Returns ffffaaaallllsssseeee if there is no such association.
-
- bool
- rrrreeeemmmmoooovvvveeee(bool (*fn)(const_reference,void*), void* d);
-
-
- Removes the first association aaaa in self such that the expression
- ((((((((****ffffnnnn))))((((aaaa,,,,dddd)))))))) is ttttrrrruuuueeee and returns ttttrrrruuuueeee. Returns ffffaaaallllsssseeee if there is no such
- element. ffffnnnn points to a user-defined tester function which must have
- prototype:
-
-
-
-
-
- bool yourTester(const_reference a, void* d);
-
-
- Client data may be passed through parameter dddd.
-
- size_type
- rrrreeeemmmmoooovvvveeeeAAAAllllllll(const K& key);
-
-
- Removes all associations in self that have a key jjjj that compares equal to
- kkkkeeeeyyyy. Returns the number of items removed.
-
- size_type
- rrrreeeemmmmoooovvvveeeeAAAAllllllll(bool (*fn)(const_reference,void*), void* d);
-
-
- Removes all associations aaaa in self such that the expression
- ((((((((****ffffnnnn))))((((aaaa,,,,dddd))))))))is ttttrrrruuuueeee. Returns the number of items removed. ffffnnnn points to
- a user-defined tester function which must have prototype:
-
-
-
-
-
-
-
- PPPPaaaaggggeeee 7777
-
-
-
-
-
-
- RRRRWWWWTTTTVVVVaaaallllMMMMuuuullllttttiiiiMMMMaaaapppp((((3333CCCC++++++++)))) RRRRWWWWTTTTVVVVaaaallllMMMMuuuullllttttiiiiMMMMaaaapppp((((3333CCCC++++++++))))
-
-
-
- bool yourTester(const_reference a, void* d);
-
-
- Client data may be passed through parameter dddd.
-
- multimap<K,T,C,allocator>&
- ssssttttdddd();
- const multimap<K,T,C,allocator>&
- ssssttttdddd() const;
-
-
- Returns a reference to the underlying C++-standard collection that serves
- as the implementation for self. This reference may be used freely,
- providing access to the C++-standard interface as well as
- interoperability with other software components that make use of the
- C++-standard collections.
-
- RRRReeeellllaaaatttteeeedddd GGGGlllloooobbbbaaaallll OOOOppppeeeerrrraaaattttoooorrrrssss
- RWvostream&
- ooooppppeeeerrrraaaattttoooorrrr<<<<<<<<(RWvostream& strm,
- const RWTValMultiMap<K,T,C>& coll);
- RWFile&
- ooooppppeeeerrrraaaattttoooorrrr<<<<<<<<(RWFile& strm, const RWTValMultiMap<K,T,C>& coll);
-
-
- Saves the collection ccccoooollllllll onto the output stream ssssttttrrrrmmmm, or a reference to
- it if it has already been saved.
-
- RWvistream&
- ooooppppeeeerrrraaaattttoooorrrr>>>>>>>>(RWvistream& strm, RWTValMultiMap<K,T,C>& coll);
- RWFile&
- ooooppppeeeerrrraaaattttoooorrrr>>>>>>>>(RWFile& strm, RWTValMultiMap<K,T,C>& coll);
-
-
- Restores the contents of the collection ccccoooollllllll from the input stream ssssttttrrrrmmmm.
-
- RWvistream&
- ooooppppeeeerrrraaaattttoooorrrr>>>>>>>>(RWvistream& strm, RWTValMultiMap<K,T,C>*& p);
- RWFile&
- ooooppppeeeerrrraaaattttoooorrrr>>>>>>>>(RWFile& strm, RWTValMultiMap<K,T,C>*& p);
-
-
- Looks at the next object on the input stream ssssttttrrrrmmmm and either creates a
- new collection off the heap and sets pppp to point to it, or sets pppp to point
- to a previously read instance. If a collection is created off the heap,
- then you are responsible for deleting it.
-
-
-
-
-
-
-
-
-
- PPPPaaaaggggeeee 8888
-
-
-
-